<?php
class Sectores_emp extends CI_Controller{

    var $url ='empresa/sector_emp/';

    function __construct(){
        parent::__construct();
        //$this->lang->load('empresa/datos');
        //$this->load->library('form_validation');
    }

    function autocomplete(){
		$term   =$this->input->post('term');
		$terme  =$this->db->escape('%'.$term.'%');
		$query  ="SELECT id,nombre FROM sectores_emp WHERE nombre like $terme ORDER BY nombre";
		$mSQL   = $this->db->query($query);
		$arreglo= $mSQL->result_array($query);
		foreach($arreglo as $key=>$value)
			foreach($value as $key2=>$value2)
				$arreglo[$key][$key2] = $value2;

		header('Content-type: text/html; charset=utf-8');
		echo json_encode($arreglo);
	}
}
?>
